package com.yutel.phone.binh.ui.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yutel.phone.binh.data.vo.Channel;

public class ChannelAdapter extends BaseAdapter {
	private ArrayList<Channel> channels;
	private Activity activity;

	public ChannelAdapter(ArrayList<Channel> channels, Activity activity) {
		this.activity = activity;
		this.channels = channels;
	}

	@Override
	public int getCount() {
		return channels.size();
	}

	@Override
	public Object getItem(int position) {
		return channels.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View paramView, ViewGroup paramViewGroup) {
		LayoutInflater localLayoutInflater = this.activity.getLayoutInflater();
		paramView = localLayoutInflater.inflate(android.R.layout.simple_list_item_1, null);
		Channel resp = channels.get(position);
		paramView.setTag(resp);
		TextView name = (TextView) paramView.findViewById(android.R.id.text1);
		name.setText(resp.getName());
		return paramView;
	}
}
